﻿@{
    Layout = null;
}

<form id="form_AddRole" role="form" onkeydown="if(event.keyCode==13){return false;}">
    <div class="row" style="margin-top:15px;">
        <div class="col-xs-2 col-md-2 text-right">
            <span class="red-600">*</span>
            角色名称：
        </div>
        <div class="col-xs-10 col-md-10">
            <input type="text" class="form-control" autocomplete="off" placeholder="请输入角色名称" id="RoleName$value" name="RoleName" maxlength="20">
        </div>
    </div>

    <div class="row">
        <div class="col-xs-2 col-md-2 text-right">
            备注：
        </div>
        <div class="col-xs-10 col-md-10">
            <textarea class="form-control" id="Remark$value" name="Remark"></textarea>
        </div>
    </div>
</form>
<script>
    var $label = '<label class="col-xs-6 col-sm-6 col-md-6 col-lg-6"><input type="checkbox" class="ButtonRoleType" value="' + 111 + '" />' + 111 + '</label>'
    var $LayerRowStart = '<div onclick="event.cancelBubble = true" class="LayerRow"  style="border:2px solid #e4eaec;width:200px;height:auto;position:absolute;z-index:1051;background:#FFFFFF;padding-top:5px">'
    var $LayerRowOver = '<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="border-top: 1px solid #e4eaec;padding:5px"><button type="button" class="btn btn-sm btn-primary pull-right LayerT" style="margin-left:5px">确定</button><button type="button"  class="btn btn-sm pull-right LayerF">取消</button></div></div>'
    var $LayerRow = $LayerRowStart + $label + $label + $label + $label + $LayerRowOver

    $(document)
        .on("click", ".TwoLevelMEnu", function () {
            if ($(this).find(".LayerRow").length == 0) {
                $(this).append($LayerRow)
            } else {
                $(this).find(".LayerRow").show()
            }
            e.stopPropagation();
        })
        .on("click", ".AllClick", function () {
            if ($(this).find(".LayerRow").length == 0 || $(this).find(".LayerRow").is(":hidden")) {
                $(".TwoLevelMEnu").click()
                return false;
            } else {
                if (this.checked) {
                    $(this).parents("TwoLevelMEnu").find(".LayerRow").find("input").prop("checked", true);
                } else {
                    $(this).parents("TwoLevelMEnu").find(".LayerRow").find("input").prop("checked", false);
                }
            }
            e.stopPropagation();
        })
        
</script>
<script>

    $(function () {
        $('#form_AddRole').bootstrapValidator({
            group: '.col-xs-10.col-md-10',
            fields: {
                RoleName: {
                    validators: {
                        notEmpty: {
                            message: '角色名称不能为空'
                        },
                        stringLength: {
                            max: 20,
                            message: '角色名称最大长度为20'
                        },
                        regexp: {
                            regexp: /^[a-zA-Z\u4e00-\u9fa5]+$/,
                            message: '角色名称不能输入符号和数字'
                        }
                    }
                }
            }
        });
    })
</script>
